package lp.chess.ui;

import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import javax.swing.JComponent;
import javax.swing.JFrame;


public class GUIHelper {
	private static JFrame m_frame;
	
	public static void showOnFrame(JComponent component, String frameName) {
		JFrame m_frame = new JFrame(frameName);
		WindowAdapter wa = new WindowAdapter() {
			public void windowClosing(WindowEvent e) {
				System.exit(0);
			}
		};
		m_frame.addWindowListener(wa);
		m_frame.getContentPane().add(component);
		m_frame.pack();
		m_frame.setVisible(true);
	}

	public static JFrame getFrame() {
		return m_frame;
	}
}
